package org.example.poi.EasyExcel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

//easyexcel与poi有依赖冲突，需要排除poi的依赖
public class OEN {
    public static void main(String[] args) throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream("d:\\1.xls");
        EasyExcel.read(fileInputStream)
                .head(ExcelVO.class)
                .sheet("Sheet1")
                .registerReadListener(new AnalysisEventListener<ExcelVO>() {
                    @Override
                    public void invoke(ExcelVO o, AnalysisContext analysisContext) {
                        System.out.println(o);
                    }

                    @Override
                    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
                        System.out.println("文件读取完成");
                    }
                })
                .doRead();
    }
}
